package com.system.borrow.activity;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.widget.TextView;

import com.system.borrow.R;
import com.system.borrow.utils.SecondTitle;

public class AboutActivity extends BaseActivity {

    private TextView tv_version,tv_jieshao;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about);
        SecondTitle title = new SecondTitle(this);
        title.setTitle("关于我们", null);

        tv_version = (TextView) findViewById(R.id.tv_version);
        tv_jieshao = (TextView) findViewById(R.id.tv_jieshao);
//        tv_jieshao.getPaint().setFlags(Paint. UNDERLINE_TEXT_FLAG ); //下划线
        String version = getVersionName();

        tv_version.setText("V" + version);
    }

    /**
     * 获取当前的版本号
     *
     * @return
     */
    private String getVersionName() {
        // 获取packagemanager的实例
        PackageManager packageManager = getPackageManager();
        // getPackageName()是你当前类的包名，0代表是获取版本信息

        try {
            PackageInfo packInfo = packageManager.getPackageInfo(getPackageName(), 0);
            String version = packInfo.versionName;
            return version;
        } catch (PackageManager.NameNotFoundException e) {

            e.printStackTrace();
        }
        return "";
    }
}
